home *** CD-ROM | disk | FTP | other *** search
- #
- # top-level access: show all the Forums
- #
- #
- # Copyright (C) 1994 Afzal Ballim
-
- ############################################################
- #
- # WFCommandTop: display all of the available forums.
- #
- sub WFCommandTop {
- local (%in)=@_;
-
- # check to see if this has been called with a sort option
- # if not set alphabetic by default
- if ($in{"sortmethod"} eq "") {
- $in{"sortmethod"}="alphabetic";
- }
-
- # get the list of directories in the spool directory.
- # Those are the forums
- opendir(DIR,"ABSWFSPOOL");
- @slist=readdir(DIR);
- close(DIR);
-
- #get the info for the directories
- for (@slist) {
- next unless -d "ABSWFSPOOL/$_";
- next if $_ eq '.';
- next if $_ eq '..';
- push(@forums,$_);
- }
-
- $thelist="";
-
- # sort the forums
- if ($in{"sortmethod"} eq "alphabetic") {
- @forums=sort @forums; }
- else {
- @forums = sort WFTopstatbymostrecent @forums;
- }
-
- foreach $fname (@forums) {
- $fnamedec=&WFDecodeDatum($fname);
- $thelist = $thelist . <<EI;
- <li>
- <form method="POST" action="STD_DOCOMMAND">
- <input type="hidden" name="command" value="forum">
- <input type="hidden" name="forum" value="$fname">
- <input type="submit" value="$fnamedec">
- </form>
- </li>
- EI
- }
-
- if ($in{"sortmethod"} eq "alphabetic") {
- &WFIncFile("ABSWFHTML/TOP.HTML",
- FORUMLIST,"$thelist",
- SORTYPE,"$in{sortmethod}",
- ASORT,checked,
- MRCSORT,'') }
- else {
- &WFIncFile("ABSWFHTML/TOP.HTML",
- FORUMLIST,"$thelist",
- SORTYPE,"$in{sortmethod}",
- ASORT,'',
- MRCSORT,checked) }
-
- return "";
- }
-
- sub WFTopstatbymostrecent {
- local (@d1) = stat("ABSWFSPOOL/$a");
- local (@d2) = stat("ABSWFSPOOL/$b");
- $d2[9] <=> $d1[9];
- }
-
- 1;
-